unit SecretPass;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Mask;

type
  TSecretPassForm = class(TForm)
    Label1: TLabel;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox3: TCheckBox;
    CheckBox4: TCheckBox;
    procedure KeyPress(Sender: TObject; var Key: Char);
  private
    CurTime, CheckStr: string;
    PressCounter: Integer;
    { Private declarations }
  public
    { Public declarations }
    function FormShow : Boolean;
  end;

var
  SecretPassForm: TSecretPassForm;

implementation

{$R *.dfm}

function TSecretPassForm.FormShow : Boolean;
begin
  PressCounter := 0;
  CheckStr:='0000';
  CheckBox1.Checked:=false;
  CheckBox2.Checked:=false;
  CheckBox3.Checked:=false;
  CheckBox4.Checked:=false;
  ShowModal;
  DateTimeToString(CurTime,'hhmm',Now);
  if CheckStr=CurTime then result:=true else result:=false;
end;

procedure TSecretPassForm.KeyPress(Sender: TObject;  var Key: Char);
begin
  inc(PressCounter);
  CheckStr[PressCounter]:=Key;
  if (PressCounter=1) then CheckBox1.Checked:=true;
  if (PressCounter=2) then CheckBox2.Checked:=true;
  if (PressCounter=3) then CheckBox3.Checked:=true;
  if (PressCounter=4) then SecretPassForm.Close;
end;

end.
